//
//  TeacherEvaluationViewController.m
//  teaching
//
//  Created by 衣尚品1 on 15/5/9.
//  Copyright (c) 2015年 衣尚品1. All rights reserved.
//

#import "TeacherEvaluationViewController.h"


@interface TeacherEvaluationViewController (){
    UIAlertView *alert;
    UIAlertView *alert1;
}

@end

@implementation TeacherEvaluationViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    //加载星星
    [self SetUpStar];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - 星星代码显示
-(void)SetUpStar{
    
    TQStarRatingView *starRatingView = [[TQStarRatingView alloc] initWithFrame:CGRectMake(115, 120, 189, 40) numberOfStar:5];
    
    //此方法一旦调用，评分就不可变
//    [starRatingView StarScore:0.53];
    [starRatingView StarGrade:0];
    
    starRatingView.delegate = self;
    
    [self.view addSubview:starRatingView];
    
}

-(void)starRatingView:(TQStarRatingView *)view score:(float)score
{
    //返回评分的值
//    self.label.text = [NSString stringWithFormat:@"%0.2f",score * 5 ];
    
    
}

- (IBAction)clickEnsure:(id)sender {
    
    alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"确认支付并评价吗？" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确认", nil];
    [alert show];
}

- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex{
    if (alertView == alert) {
        if (buttonIndex == 1) {
            alert1 = [[UIAlertView alloc] initWithTitle:nil message:@"支持成功！" delegate:self cancelButtonTitle:nil otherButtonTitles:nil, nil];
            [alert1 show];
            [self performSelector:@selector(dismissAlertView) withObject:nil afterDelay:1.0f];
        }
        
    }
    
}


- (void)dismissAlertView{
    [alert1 dismissWithClickedButtonIndex:0 animated:YES];
    [self.navigationController popViewControllerAnimated:YES];
}

@end
